<?php
require_once("../config.php");
//if(!isset($_SESSION['admin_user'])) header("location:index.php");
//require_once(CONSTANT."alltype.php");
//page_constant("admin");

$tpl->assign("type_brand",$type_brand_c);

$dsql->setquery("select * from brand ");
$dsql->Execute();
while($row=$dsql->GetArray())
	$brand[]=$row;
$tpl->assign("brand",$brand);

$dsql->SetQuery("select * from alltype");
$dsql->Execute();
while($row=$dsql->GetArray())
	$alltype[]=$row;
foreach ($alltype as $key => $value)
{
	$type[$value['id']]=$value['typename'];
}
	
foreach($brand as $k=>$value)
{
	foreach($value as $key=>$item)
	{
		if($key!="id" and is_numeric($item))
		{
			$brand_c[$k][$key]=$type[$item];
		}
		else
			$brand_c[$k][$key]=$brand[$k][$key];
	}

}
$tpl->assign("brand",$brand_c);

if(isset($_POST) and !empty($_POST))
{
	$postarray=$_POST;
	//var_dump($postarray);
	$uid=new UID();
	$uid->insert("brand",$postarray);
	$tpl->assign("msg",1);
}

$tpl->display("admin_brand_check.tpl");
?>